{% extends "account/layout.html" %}
{% block body %}
{% load i18n %}
<div class="container theme-showcase" role="main">
    <video id="videoElement" height="480" width="640" style="border:thin solid black" controls loop></video>
    <h1>Hello flv</h1>
    <button onclick="play()">播放</button>
    <button onclick="pause()">暂停</button>   
    <script src="/static/js/flv.js"></script>
    <script>
        var videoElement = document.getElementById('videoElement');
        var flvPlayer = flvjs.createPlayer({
            isLive:true,
            type: 'flv',
            url: 'http://192.168.3.235/live?app=demo&stream=stream-1',
            enableWorker: true,
            enableStashBuffer: false,
            stashInitialSize: 128    // 减少首桢显示等待时长
        });
        flvPlayer.attachMediaElement(videoElement);
        flvPlayer.load();

        function play(){
            flvPlayer.play();
        }

        function pause(){
            flvPlayer.pause();
        }
    </script>
</div>
{% endblock %}